﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Windows.Forms.Integration;
using System.Windows.Forms;

namespace HabitAnalyzer
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Predictions : Window
    {
        ObservableCollection<SessionActivity> _ActInfo = new ObservableCollection<SessionActivity>();
        DbUtility db;
        int sessionID;
        
        public Predictions(int ID)
        {

            InitializeComponent();
            sessionID = ID;
            db = new DbUtility();
            LoadDayList();
            LoadWeekList();
            LoadMonthList();
            
            
        }

        public void LoadDayList()
        {
            IEnumerable<object> acts = db.GetActivityRemindersDaily(this.sessionID);
            if (acts.ToList().Count != 0)
            {
                listBox2.DisplayMemberPath = "Name";
                listBox2.ItemsSource = acts;
                label4.Visibility = Visibility.Visible;
                label5.Visibility = Visibility.Visible;
                listBox2.Visibility = Visibility.Visible;
            }
        }

        public void LoadWeekList()
        {
            IEnumerable<object> acts = db.GetActivityRemindersWeekly(this.sessionID);
            if (acts.ToList().Count != 0)
            {
                listBox1.DisplayMemberPath = "Name";
                listBox1.ItemsSource = acts;
                label2.Visibility = Visibility.Visible;
                label3.Visibility = Visibility.Visible;
                listBox1.Visibility = Visibility.Visible;
            }
        }

        public void LoadMonthList()
        {
            IEnumerable<object> acts = db.GetActivityRemindersMonthly(this.sessionID);
            if (acts.ToList().Count != 0)
            {
                listBox3.DisplayMemberPath = "Name";
                listBox3.ItemsSource = acts;
                label1.Visibility = Visibility.Visible;
                label6.Visibility = Visibility.Visible;
                listBox3.Visibility = Visibility.Visible;
            }
        }

        public ObservableCollection<SessionActivity> ActInfo
        { get { return _ActInfo; } }

        private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void Predictions_Loaded(object sender, RoutedEventArgs e)
        {
           /* 
    // Create the interop host control.
    System.Windows.Forms.Integration.WindowsFormsHost host =
        new System.Windows.Forms.Integration.WindowsFormsHost();

    // Create the MaskedTextBox control.
    MaskedTextBox mtbDate = new MaskedTextBox("00/00/0000");

    // Assign the MaskedTextBox control as the host control's child.
    host.Child = mtbDate;

    // Add the interop host control to the Grid
    // control's collection of child controls.
    this.grid1.Children.Add(host);
            */

            /*
             * HabitAnalyzer.habitanalyzerDataSet habitanalyzerDataSet = ((HabitAnalyzer.habitanalyzerDataSet)(this.FindResource("habitanalyzerDataSet")));
            // Load data into the table Acitivity. You can modify this code as needed.
            HabitAnalyzer.habitanalyzerDataSetTableAdapters.AcitivityTableAdapter habitanalyzerDataSetAcitivityTableAdapter = new HabitAnalyzer.habitanalyzerDataSetTableAdapters.AcitivityTableAdapter();
            habitanalyzerDataSetAcitivityTableAdapter.Fill(habitanalyzerDataSet.Acitivity);
            System.Windows.Data.CollectionViewSource acitivityViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("acitivityViewSource")));
            acitivityViewSource.View.MoveCurrentToFirst();
            // Load data into the table SessionActivity. You can modify this code as needed.
            HabitAnalyzer.habitanalyzerDataSetTableAdapters.SessionActivityTableAdapter habitanalyzerDataSetSessionActivityTableAdapter = new HabitAnalyzer.habitanalyzerDataSetTableAdapters.SessionActivityTableAdapter();
            habitanalyzerDataSetSessionActivityTableAdapter.Fill(habitanalyzerDataSet.SessionActivity);
            System.Windows.Data.CollectionViewSource sessionActivityViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("sessionActivityViewSource")));
            sessionActivityViewSource.View.MoveCurrentToFirst();
             */
        }

        private void listBox2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void listBox1_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {

        }

        private void listBox3_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }
    }
}
